package org.nox.helloseries.server.services.configuration.impl;

import java.util.List;

import org.nox.helloseries.domain.NomTracker;
import org.nox.helloseries.domain.Tracker;
import org.nox.helloseries.factory.HelloSeriesServiceFactory;
import org.nox.helloseries.rest.client.configuration.RESTConfigurationService;
import org.nox.helloseries.server.services.configuration.TrackerConfigurationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DefaultTrackerConfigurationService implements TrackerConfigurationService
{
    private static final Logger LOG = LoggerFactory.getLogger( TrackerConfigurationService.class );

    private RESTConfigurationService restConfigurationService = HelloSeriesServiceFactory.createOrGetService( RESTConfigurationService.class );

    @Override
    public void updateTrackers( List<Tracker> trackersToBeUpdated )
    {
        LOG.info( "Mise à jour des trackers" );
        restConfigurationService.updateTrackers( trackersToBeUpdated );
        LOG.info( "Mise à jour des trackers terminée" );
    }

    @Override
    public Tracker getTracker( NomTracker nomTracker )
    {
        LOG.info( "Récupération des infos du tracker {}", nomTracker );
        return restConfigurationService.getTracker( nomTracker );
    }

}
